package com.zking.web.zzsf;




import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.zking.dao.domain.Information;
import com.zking.dao.domain.Post;
import com.zking.dao.domain.Word;
import com.zking.service.impl.zzsf.InformationImpl;

@Controller

public class InformationController {
	@Autowired
	InformationImpl informationImpl;
	
	@RequestMapping("/mg")
	public String reg(Information information) {
		int i =informationImpl.addLabel(information);
		if (i != 0) {
			return "founder";
		}else {
			return "reg";
		}
	}
	
	@RequestMapping("/com")
	public String queryCom(Integer id,Integer information_id,Information information,Post post,HttpServletRequest request){
		List<Map<String, Object>> ps = informationImpl.findMg(id,information_id);
		request.getSession().setAttribute("post", ps);
		System.out.println(ps);
	//	model.addObject("post", ps);
	//	model.setViewName("jobdetail1");
//		Word wo = informationImpl.word(id);
//		System.out.println(id);
//		if (infor != null) {
//			System.out.println(infor);
//			model.addObject("infor", infor);
//			model.setViewName("jobdetail1");
//		}if(ps != null) {
//			model.addObject("post", ps);
//			model.setViewName("jobdetail1");
//		}if (wo != null) {
//			model.addObject("wo", wo);
//			model.setViewName("jobdetail1");
//		}
		return "jobdetail1";
	}
}
